{% extends 'TopxiaWebBundle:CourseManage:layout.html.twig' %}

{% block title %}基本信息 - {{ parent() }}{% endblock %}

{% set side_nav = 'base' %}
{% set script_controller = 'course-manage/base' %}
{% 
  set script_arguments = {
    categoryUrl: path('category_all'),
    tagMatchUrl: path('tag_match'),
    locationUrl: path('location_all')
  } 
%}
{% block main %}
<!--    滑块-->
<script src="{{ asset('assets/libs/jquery.min.js') }}"></script>
<script src="{{ asset('assets/libs/jquery-ui.min.js') }}"></script>
    <link href="{{ asset('bundles/topxiaweb/css/jquery-ui.min.css') }}" rel="stylesheet"/>
<div class="panel panel-default panel-col">
  <div class="panel-heading">基本信息</div>
  <div class="panel-body">
    <form class="form-horizontal" id="course-form" method="post">

      {{ web_macro.flash_messages() }}

      <div class="form-group">
        <label class="col-md-2 control-label">标题</label>
        <div class="col-md-8 controls">
          <input type="text" id="course_title" name="title" required="required" class="form-control" value="{{ course.title|default('') }}">
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">副标题</label>
        <div class="col-md-8 controls">
          <textarea id="course_subtitle" name="subtitle" required="required" class="form-control">{{ course.subtitle|default('') }}</textarea>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">关键词</label>
        <div class="col-md-8 controls">
          <textarea id="course_seo" name="seo" required="required" class="form-control">{{ course.seo|default('') }}</textarea>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">描述</label>
        <div class="col-md-8 controls">
          <textarea id="course_description" name="description" required="required" class="form-control">{{ course.description|default('') }}</textarea>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">标签</label>
        <div class="col-md-8 controls">
          <input type="text" id="course_tags" name="tags" required="required" class="width-full select2-offscreen" tabindex="-1" value="{{ tags|join(',') }}" data-explain="将会应用于按标签搜索课程、相关课程的提取等">
          <div class="help-block">将会应用于按标签搜索课程、相关课程的提取等</div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">课程购买</label>
          <div class="col-md-8 controls radios">
            {{ radios('buyable', {'1':'开启', '0':'关闭'}, course.buyable|default(1) ) }}
           <div class="help-block">关闭后课程将无法在线购买加入、由教师/管理员后台导入。</div>
        </div>
      </div>
        <div class="row form-group">
      <div class="col-md-2 control-label"> 
        <label for="weixin">用户等级</label>
      </div>
      <div class="col-md-7 controls">
        <p>
  <label for="amount">当前会员等级：</label>
  <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;">
    <input type="hidden" name="level"  value="0" id="level"/>      
</p>
<div id="slider-range-max"></div>
     </div>
    </div> 
        
       <div class="form-group">
        <label class="col-md-2 control-label">是否在前台显示</label>
          <div class="col-md-8 controls radios">
            {{ radios('isshow', {'1':'显示', '0':'隐藏'}, course.isshow|default(1) ) }}
           <div class="help-block">是否让课程在前台展示</div>
        </div>
      </div>
      <div class="form-group">
        <label class="col-md-2 control-label">是否设为活动</label>
          <div class="col-md-8 controls radios">
            <!--{{ radios('discountId', {'1':'是', '0':'否'}, course.discountId|default(0) ) }}-->

            
            <input id="one" type="radio" onClick="checkBox(this);" name="discountId"{% if course.discountId != '0' %}checked="checked" {% endif %} value="{{ course.id }}"/>是
              <input id="two" type="radio" onClick="checkBox1(this);" name="discountId" {% if course.discountId == '0' %}checked="checked" {% endif %} value="0"/>否
             
           <div class="help-block">选择是可以设置相应的活动时间</div>
        </div>
      </div>
        {% if course.discountId == '0' %}
          <div id="div1" style="display:none;">
        {% else %}
          <div id="div1" >
        {% endif %}
         <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">活动开始日期</label>
          <div class="col-md-8 controls">
            <input type="datetime"  id="dateinfo" name="activitiesstarttime" required="required" class="form-control width-input width-input-large" value="{{ course.activitiesstarttime }}" >
            <div class="help-block">活动的开始时间 时间格式：2016-02-01 00:00:00</div>
          </div>
        </div>
         <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">活动结束日期</label>
          <div class="col-md-8 controls">
            <input type="datetime"  id="dateinfo1" name="activitiesendtime" required="required" class="form-control width-input width-input-large" value="{{ course.activitiesendtime }}" >
            <div class="help-block">活动的结束时间 时间格式：2016-02-01 00:00:00</div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">活动折扣</label>
          <div class="col-md-8 controls">
            <input type="text"  name="discount" required="required" class="form-control width-input width-input-large" value="{{ course.discount }}" > %
            <div class="help-block">活动折扣</div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">活动送积分</label>
          <div class="col-md-8 controls">
            <input type="text"  name="integral" required="required" class="form-control width-input width-input-large" value="{{ course.integral }}" > 
            <div class="help-block">活动时购买课程赠送积分</div>
          </div>
        </div>
      </div>
	  
	  
	  <div class="form-group">
		<label class="col-md-2 control-label" for="course_expiryDay">开启冰点价</label>
		<div class="col-md-8 controls">
		{{ radios('isice', {'1':'开启', '0':'关闭'}, course.isice|default(0) ) }}
		<div class="help-block">选择是可以设置冰点价相关设置</div>
		</div>
	  </div>
	  <div id="icediv" {% if course.isice == '0' %}style="display:none;"{% endif %}>
         <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">冰点价开始日期</label>
          <div class="col-md-8 controls">
            <input type="datetime" id="icetime1" name="icestarttime" required="required" class="form-control width-input width-input-large" value="{{ course.icestarttime }}" >
            <div class="help-block">冰点价开始时间 时间格式：2016-02-01 00:00:00</div>
          </div>
        </div>
         <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">冰点价结束日期</label>
          <div class="col-md-8 controls">
            <input type="datetime" id="icetime2" name="iceendtime" required="required" class="form-control width-input width-input-large" value="{{ course.iceendtime }}" >
            <div class="help-block">冰点价结束时间 时间格式：2016-02-01 00:00:00</div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label" for="course_expiryDay">冰点价</label>
          <div class="col-md-8 controls">
            <input type="text"  name="iceprice" required="required" class="form-control width-input width-input-large" value="{{ course.iceprice }}" > %
            <div class="help-block">冰点价</div>
          </div>
        </div>
      </div>
	  
	  
      {% if course.type == 'live' %}

      <div class="form-group">
        <label class="col-md-2 control-label" for="maxStudentNum-field">直播最大{{setting('default.user_name')|default('学员')}}数</label>
        <div class="col-md-8 controls">
          <input type="text" id="maxStudentNum-field" name="maxStudentNum" class="form-control width-input width-input-large" value="{{ course.maxStudentNum|default(20) }}" data-live-capacity-url="{{path('live_capacity',{id:course.id})}}"> 人
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      {% endif %}

      <div class="form-group">
        <label class="col-md-2 control-label" for="course_expiryDay">{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}有效期</label>
        <div class="col-md-8 controls">
          <input type="text" id="course_expiryDay" name="expiryDay" required="required" class="form-control width-input width-input-large" value="{{ course.expiryDay }}" > 天
          <div class="help-block">设置该值后，{{setting('default.user_name', '学员')}}只能在有效期内进行课程的相关操作，系统默认会在到期前10天提醒{{setting('default.user_name', '学员')}}。该值为0，则不做此限制。</div>
        </div>
      </div>

      {% if course.type == 'normal' %}
        <div class="form-group">
          <label class="col-md-2 control-label">连载状态</label>
          <div class="col-md-8 controls radios">
            {{ radios('serializeMode', {'none':'非连载课程', 'serialize':'更新中', 'finished':'已完结'}, course.serializeMode|default('none') ) }}
          </div>
        </div>
      {% endif %}

      {% if setting('magic.lesson_watch_limit') %}
        <div class="form-group">
          <label class="col-md-2 control-label">视频观看时间限制</label>
          <div class="col-md-8 controls">
            <input type="text" id="course_expiryDay" name="watchLimit" required="required" class="form-control width-input width-input-large" value="{{ course.watchLimit }}" > 倍单视频总时长
            <div class="help-block">0表示不限制。</div>
          </div>
        </div>
      {% endif %}

      {% if setting('magic.buy_before_approval') %}
        <div class="form-group">
          <label class="col-md-2 control-label">实名认证</label>
          <div class="col-md-8 controls radios">
            {{ radios('approval', {'1':'是', '0':'否'}, course.approval ) }}
            <div class="help-block">设置该值后，学员购买课程前，必须先去申请实名认证。</div>
          </div>
        </div>
      {% endif %}
      
      <div class="form-group">
        <label class="col-md-2 control-label">分类</label>
        <div class="col-md-8 controls">
          <select id="course_categoryId" name="categoryId" required="required" class="form-control width-input width-input-large">
            {{ select_options(category_choices('course'), course.categoryId, '分类') }}
          </select>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>
			  
	<div class="form-group">
        <label class="col-md-2 control-label">设置季度VIP课程</label>
        <div class="col-md-8 controls">
			
          <select id="course_categoryId" name="vip" required="required" class="form-control width-input width-input-large"><option value='1' >1</option>
			  
          </select>
           <div class="help-block">设置季度VIP课程后，学员免费观看</div>
        </div>
      </div>
      {% if course.type == 'live'%}
      <div id="live-plugin-url" class="form-group hidden">
          <div class="col-md-offset-2 col-md-8 controls">
            <a  href="" target="_blank">直播“桌面分享”插件下载</a>
          </div>
      </div>
      {% endif %}
      <div class="form-group">
        <div class="col-md-offset-2 col-md-8 controls">
            <button class="btn btn-fat btn-primary" id="course-create-btn" type="submit">保存</button>
        </div>
      </div>

      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

    </form>
  </div>
</div>
<script type="text/javascript">

    jeDate({
    dateCell:"#dateinfo",
    format:"YYYY-MM-DD hh:mm:ss",
    isinitVal:true,
    festival:true,
    marks:['2015-01-03','2016-01-01','2016-01-10','2016-01-15','2016-02-15','2016-03-10','2016-04-18'],
    isTime:true, //isClear:false,
    minDate:"2014-09-19 00:00:00",
    //okfun:function(val){alert(val)}
  })
  jeDate({
    dateCell:"#dateinfo1",
    format:"YYYY-MM-DD hh:mm:ss",
    isinitVal:true,
    festival:true,
    marks:['2015-01-03','2016-01-01','2016-01-10','2016-01-15','2016-02-15','2016-03-10','2016-04-18'],
    isTime:true, //isClear:false,
    minDate:"2014-09-19 00:00:00",
    //okfun:function(val){alert(val)}
  })
  jeDate({
    dateCell:"#icetime1",
    format:"YYYY-MM-DD hh:mm:ss",
    isinitVal:true,
    festival:true,
    marks:['2015-01-03','2016-01-01','2016-01-10','2016-01-15','2016-02-15','2016-03-10','2016-04-18'],
    isTime:true, //isClear:false,
    minDate:"2014-09-19 00:00:00",
    //okfun:function(val){alert(val)}
  })
  jeDate({
    dateCell:"#icetime2",
    format:"YYYY-MM-DD hh:mm:ss",
    isinitVal:true,
    festival:true,
    marks:['2015-01-03','2016-01-01','2016-01-10','2016-01-15','2016-02-15','2016-03-10','2016-04-18'],
    isTime:true, //isClear:false,
    minDate:"2014-09-19 00:00:00",
    //okfun:function(val){alert(val)}
  })

  function checkBox(cb) { 

    var oOne = document.getElementById("one"); 
    var oDiv1 = document.getElementById("div1"); 
          if (cb.id=="one") { 
              oDiv1.style.display="inline" 
          }
  } 
  function checkBox1(cb) { 

    var oOne = document.getElementById("two"); 
    var oDiv1 = document.getElementById("div1"); 
          if (cb.id=="two") { 
              oDiv1.style.display="none" 
          }
  } 
</script>
  
{% endblock %}



